﻿using Common.Communal;
using ERP.Domain.Workorders.Inventory;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Product.API.Read.Applications.Commands.WorkOrder.Inventory;
using Product.API.Read.DTOS;
using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;

namespace Product.API.Read.Controllers
{
    /// <summary>
    /// 库存入库出库API-读
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class InventoryTransactionWorkOrderController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;

        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator">中介者</param>
        public InventoryTransactionWorkOrderController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 入库出库显示
        /// </summary>
        /// <param name="command">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet("InventoryTransactionWorkOrderShow")]
        public Task<ApiResult<ApiPaging<InventoryTransactionWordOrder>>> InventoryTransactionWorkOrderShow([FromQuery] InventoryTransactionWorkOrderShowCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 入库显示
        /// </summary>
        /// <param name="command">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet("OutInventoryTransactionShow")]
        public Task<ApiResult<ApiPaging<InventoryTransactionWordOrder>>> OutInventoryTransactionShow([FromQuery] OutInventoryTransactionCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 出库显示
        /// </summary>
        /// <param name="command">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet("IntoInventoryTransactionShow")]
        public Task<ApiResult<ApiPaging<InventoryTransactionWordOrder>>> IntoInventoryTransactionShow([FromQuery] IntoInventoryTransactionCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 盘点记录显示
        /// </summary>
        /// <param name="command">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet("InventoryCheckShow")]
        public Task<ApiResult<ApiPaging<InventoryCheck>>> InventoryCheckShow([FromQuery] InventoryCheckShowCommand command)
        {
            return mediator.Send(command);
        }

        /// <summary>
        /// 库存分布记录显示
        /// </summary>
        /// <param name="command">请求</param>
        /// <returns>返回任务</returns>
        [HttpGet("WarehouseDistributionShow")]

        public Task<ApiResult<WarehouseDistributionDTO>> WarehouseDistributionShow([FromQuery] WarehouseDistributionShowCommand command)
        {
            return mediator.Send(command);
        }
    }
}
